/*
 * @Description:
 * @Author: hui
 * @Date: 2022-02-18 11:49:27
 * @LastEditTime: 2022-02-22 11:35:01
 */
import { createRouter, createWebHashHistory, RouteRecordRaw,createWebHistory } from 'vue-router';

const login = () => import(`@/views/login.vue`);
const renzheng = () => import(`@/views/renzheng/index.vue`);
const openfuxing = () => import(`@/views/openfuxing/index.vue`);
const home = () => import(`@/views/home/home.vue`);
// const home = () => import(`@/views/workspace/index.vue`);
const layout = () => import(`@/layout2/layout.vue`);
const layoutUpDown = () => import(`@/layout2/layoutUpDown.vue`);


const routes: Array<RouteRecordRaw> = [
	{
		'path': `/login`,
		'name': `login`,
		'component': login
	},
    {
		'path': `/openfuxing`,
		'name': `openfuxing`,
		'component': openfuxing
	},
    {
		'path': `/renzheng`,
		'name': `renzheng`,
		'component': renzheng
	},
	// {
	// 	'path': `/`,
	// 	'name': `home`,
	// 	'component': layout,
	// 	'redirect': `/workspace`,
	// 	'children': [
	// 		// {
	// 		// 	'path': `home`,
	// 		// 	'component': home,
	// 		// 	'name': `homeIndex`
	// 		// }
	// 	]
	// },

  {
    'path': `/carbon`,
    'name': `carbon`,
    'component': layout,
    'redirect': `/carbon/product`,
    'children': [
      {
        'path': `product`, // 能碳管理-基础信息-产品
        'component': import(`@/views/carbon/product/index.vue`),
        'name': `carbonProductIndex`
      },
      {
        'path': `product/detail`, // 能碳管理-基础信息-产品详情
        'component': import(`@/views/carbon/product/detail.vue`),
        'name': `carbonProductDetail`,
      },
      {
        'path': `monitoring/index`, // 能碳管理-基础信息-产品
        'component': import(`@/views/carbon/monitoring/index.vue`),
        'name': `carbonMonitoringIndex`
      },
      {
        'path': `monitoring/view`, // 能碳管理-监控点配置-结构配置
        'component': import(`@/views/carbon/monitoring/view.vue`),
        'name': `carbonMonitoringView`,
      },
      {
        'path': `monitoring/config`, // 能碳管理-监控点配置-结构配置
        'component': import(`@/views/carbon/monitoring/config.vue`),
        'name': `carbonMonitoringConfig`,
      },
      {
        'path': `monitoring/addPoint`, // 能碳管理-监控点配置-添加监控点
        'component': import(`@/views/carbon/monitoring/addPoint.vue`),
        'name': `carbonMonitoringAddPoint`,
      },
      {
        'path': `monitoring/editPoint`, // 能碳管理-监控点配置-添加监控点
        'component': import(`@/views/carbon/monitoring/editPoint.vue`),
        'name': `carbonMonitoringEditPoint`,
      }
    ]
  },
  {
    'path': `/energyConfig`,  // 能碳管理-能源配置
    'name': `energyConfig`,
    'component': layout,
    'redirect': `/energyConfig/type`,
    'children': [
      {
        'path': `type`, // 能碳管理-能源配置-能源类型
        'component': import(`@/views/energyConfig/type/index.vue`),
        'name': `carbonEnergyConfigType`,
      },
      {
        'path': `capacityPower`, // 能碳管理-能源配置-变压器配置
        'component': import(`@/views/energyConfig/capacityPower/index.vue`),
        'name': `carbonEnergyCapacityPower`,
      }
    ]
  },
  {
    'path': `/carbonMgr`,// 能碳管理-能碳管理
    'name': `carbonMgr`,
    'component': layout,
    'redirect': `/carbonMgr/tradingBook`,
    'children': [
      {
        'path': `tradingBook`,  // 能碳管理-能碳管理-交易账簿
        'component': import(`@/views/carbonMgr/tradingBook/index.vue`),
        'name': `carbonMgrTradingBook`,
      }
    ]
  },
  {
    'path': `/bpmMgr`,  // 能碳管理-流程管理
    'name': `capacityPower`,
    'component': layout,
    'redirect': `/bpmMgr/reducer`,
    'children': [
      {
        'path': `reducer`, // 能碳管理-流程管理-减排措施
        'component':  import(`@/views/bpmMgr/reducer/index.vue`),
        'name': `bpmMgrReducer`,
      }
    ]
  },
	{
		'path': `/`,
		'name': `home`,
		'component': layout,
		'redirect': `/home`,
		'children': [
			{
				'path': `home`,
				'component': home,
				'name': `homeIndex`,
				'meta': {
					'icon': 'home',
					'title': '工作台'
				}
			}
		]
	},
];

const router = createRouter({
	// 'history': createWebHistory(),
	'history': createWebHashHistory(),
	routes
});

export default router;
